package com.windgo.mapper;

import com.windgo.bean.MarketCart;
import com.windgo.bean.MarketCartExample;
import com.windgo.bean.bo.CartUpdateBO;
import com.windgo.bean.vo.WxCartIndexInnerTotalVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface MarketCartMapper {
    long countByExample(MarketCartExample example);

    int deleteByExample(MarketCartExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(MarketCart row);

    int insertSelective(MarketCart row);

    List<MarketCart> selectByExample(MarketCartExample example);

    MarketCart selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("row") MarketCart row, @Param("example") MarketCartExample example);

    int updateByExample(@Param("row") MarketCart row, @Param("example") MarketCartExample example);

    int updateByPrimaryKeySelective(MarketCart row);

    int updateByPrimaryKey(MarketCart row);

    WxCartIndexInnerTotalVO queryTotalInfo(@Param("userId") Integer userId, @Param("b") boolean b, @Param("deleted") boolean deleted);

    Integer queryCheckedGoodsInfo(@Param("userId") Integer userId, @Param("b") boolean b, @Param("deleted") boolean deleted);

    Double queryCheckedAmountInfo(@Param("userId") Integer userId, @Param("b") boolean b, @Param("deleted") boolean deleted);

    //int addCart(@Param("userId") Integer userId, @Param("marketCart") MarketCart marketCart, @Param("marketGoods") MarketGoods marketGoods, @Param("marketGoodsProducts") MarketGoodsProduct marketGoodsProducts);

    int queryCartNum(Integer userId);

    MarketCart selectByProductIdAndUserId(@Param("productId") Integer productId, @Param("userId") Integer userId);

    void deleteByProductId(@Param("userId") Integer userId, @Param("productId") Integer productId);

    void updateCheckedByProductId(@Param("userId") Integer userId, @Param("productId") Integer productId, @Param("b") boolean b);

    int queryCartOldNum(@Param("userId") Integer userId, @Param("cartUpdateBO") CartUpdateBO cartUpdateBO);

    void updateNumberById(@Param("userId") Integer userId, @Param("cartUpdateBO") CartUpdateBO cartUpdateBO);

    Short queryTotalNumberByUserId(Integer userId);

    // 2022-10-16 21点30分 mabai增加
    List<MarketCart> selectCartByChecked(int checkedNum);


    void updateCart(Integer id);

    List<Integer> queryProductId(Integer userId);

    void updateNumber(@Param("productId") Integer productId, @Param("userId") Integer userId, @Param("buyNumber") Short buyNumber);

    boolean queryDeleted(@Param("userId") Integer userId, @Param("productId") Integer productId);

    void updateDeletedCart(@Param("productId") Integer productId, @Param("userId") Integer userId, @Param("buyNumber") Short buyNumber);

    void updateNowCart(@Param("productId") Integer productId, @Param("userId") Integer userId);

    Integer queryCartId(@Param("userId") Integer userId, @Param("productId") Integer productId);
}